from google.appengine.ext import db

class Impact(db.Model):
    """impact table"""
    pm = db.StringProperty()
    project = db.StringProperty()
    projectno = db.StringProperty()
    
    start_date = db.DateTimeProperty(auto_now_add=False)
    end_date = db.DateTimeProperty(auto_now_add=False)
    sidewalk = db.BooleanProperty()
    roadway = db.BooleanProperty()
    garage = db.BooleanProperty()
    adaparking = db.BooleanProperty()
    description = db.TextProperty()
    reviewstatus = db.StringProperty()
    geometry = db.TextProperty()
    x = db.FloatProperty()
    y = db.FloatProperty()
    #create time
    ctime = db.DateTimeProperty(auto_now_add=True)
    #modify time
    mtime = db.DateTimeProperty(auto_now=True)
    record_status = db.StringProperty(default='existing')
    user = db.UserProperty(auto_current_user=True)
    
class CsvFile(db.Model):
    """save the uploaded csv files"""
    name = db.StringProperty()
    csvfile = db.BlobProperty(default=None)
    uploadtime = db.DateTimeProperty(auto_now_add=True)
    user = db.UserProperty(auto_current_user=True)


class TrackChange(db.Expando):
    """tracking the change of testing records"""
    
    field_name = db.StringProperty(required=True)
    time_stamp = db.DateTimeProperty(auto_now_add=True)
    record_ref = db.ReferenceProperty(required=True)
    user = db.UserProperty(auto_current_user=True)
    
class ListTable(db.Expando):
    value = db.StringProperty(required=True)
    list_name = db.StringProperty(required=True)
    